package com.zecan.haniot;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: lenovo
 * \* Date: 2021/10/11
 * \* Time: 14:44
 * \* Description:
 * \
 */
public class Haniot {
    public static void main(String[] args) {
        hnt(3,'a','b','c');
    }
    public static void hnt(int n , char a , char b ,char c) {
        if(n == 1) {
            System.out.println(a + "->" + c);
        }else {
            // 将n-1层的 从 A - B 借助C
            hnt(n - 1, a , c , b);
            System.out.println(a  + "->" + c ); // 将n个模块从 A->C
            hnt(n - 1 , b, a, c);
        }
    }
}
